#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
using ll = long long;
const int mod = 100003;
ll n, m;
ll qmi(ll a, ll k, ll p)
{
    ll res = 1;
    while (k)
    {
        if (k & 1) res = res * a % p;
        a = a * a % p;
        k >>= 1;
    }
    return res;
}
int main()
{
    cin >> m >> n;
    cout << ((qmi(m, n, mod) - m * qmi(m - 1, n - 1, mod)) % mod + mod) % mod << endl;
    return 0;
}